﻿Public Class ToolboxItemConverter
    Implements IValueConverter

    Public Function Convert(value As Object, targetType As System.Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.Convert
        If Not TypeOf value Is String Then Return Nothing
        Dim result As DrawingBrush = Nothing
        Dim resName = ToolboxIconExtraction.GetResourceName(value.ToString)
        result = TryCast(ToolboxIconExtraction.ExtractIconResource(resName), DrawingBrush)
        Return result
    End Function

    Public Function ConvertBack(value As Object, targetType As System.Type, parameter As Object, culture As System.Globalization.CultureInfo) As Object Implements System.Windows.Data.IValueConverter.ConvertBack
        Throw New NotImplementedException
    End Function

End Class
